﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Common;

namespace FreeDocFlow
{
    public interface IDbManager
    {
        DbParameter CreateParameter(string name, object value);

        DbDataReader ExecuteReader(string command);
        void ExecuteNonQuery(string command);

        DbDataReader ExecuteReader(string command, DbParameter param);
        void ExecuteNonQuery(string command, DbParameter param);

        DbDataReader ExecuteReader(string command, DbParameterCollection parms);
        void ExecuteNonQuery(string command, DbParameterCollection parms);
    }

    public abstract class DbManager : IDbManager
    {
        protected static DbManager _instance;

        protected string connectionString;

        public DbManager()
        {
            connectionString = Properties.Settings.Default.ConnectionString;
        }

        public abstract DbParameter CreateParameter(string name, object value);

        public abstract DbDataReader ExecuteReader(string command);
        public abstract void ExecuteNonQuery(string command);

        public abstract DbDataReader ExecuteReader(string command, DbParameter param);
        public abstract void ExecuteNonQuery(string command, DbParameter param);

        public abstract DbDataReader ExecuteReader(string command, DbParameterCollection parms);
        public abstract void ExecuteNonQuery(string command, DbParameterCollection parms);
    }
}